package com.hangxintong.common.feign;

import com.hangxintong.common.base.dto.MemberCompanyAppAssocDTO;
import com.hangxintong.common.config.FeignConfiguration;
import com.hangxintong.common.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @Auther: tsj
 * @Date: 2020/12/31 10:07
 * @Description:
 */
@FeignClient(value = "coalition",configuration = FeignConfiguration.class)
public interface CompanyAppAssocFegin {

    /**
     * 远程保存关系
     * @param companyAppAssocDTO
     * @return
     */
    @PostMapping("/openFegin/member/saveCompany")
    MemberCompanyAppAssocDTO saveCompany(@RequestBody @Valid MemberCompanyAppAssocDTO companyAppAssocDTO) ;


    /**
     * 修改状态为退会
     * @param assocId
     * @param companyId
     * @return
     */
    @PutMapping("/openFegin/member/editCompany")
    MemberCompanyAppAssocDTO editCompany(@RequestParam("assocId") Integer assocId, @RequestParam("companyId") Integer companyId,@RequestParam Integer status);
    /**
     * 查询关系列表适用各种情况
     *
     * @param assocId     协会Id
     * @param companyType 1企业 2个人 4协会
     * @param status      1企业 2个人 4协会
     * @param cate        0个人会员 1企业会员（企业 +协会）
     * @return
     * @author mxf 2021-01-05
     */
    @GetMapping("/openFegin/member/company_app_assoc/list")
    Result queryJoinAssocCompanies(@RequestParam(name = "assocId") Integer assocId,
                                   @RequestParam(name = "companyType") Integer companyType,
                                   @RequestParam(name = "status") Integer status,
                                   @RequestParam(name = "cate") Integer cate);
    /**
    * @Description
    * @Author  Bz.Mr
    * @Date   2021/1/6 10:33
    * 查询会员单位加入协会
    */
    @GetMapping("/openFegin/member/getCompanyAppAssoc/{assocId}/{companyId}")
    Result getCompanyAppAssoc(@PathVariable(value="assocId") Long assocId,
                              @PathVariable(value="companyId") Long companyId);

    @GetMapping("/openFegin/member/findCompanyAppAssoc/{assocId}/{companyId}")
    MemberCompanyAppAssocDTO findCompanyAppAssoc(@PathVariable("assocId") Long assocId,@PathVariable("companyId") Long companyId);

    /**
     * 查询协会下所有会员单位
     * @param assocId
     * @return
     * @author mxf 2020
     */
    @GetMapping("/openFegin/member/listJoinAssocCompany/{assocId}")
    Result listJoinAssocCompany(@PathVariable("assocId") Long assocId);

    /**
     * 判断是否是某协会的会员单位
     *
     * @param assocId
     * @param companyId
     * @param companyType
     * @return
     * @author mxf 2021-02-26
     */
    @GetMapping("/openFegin/member/judgeIsMember/{assocId}/{companyId}/{companyType}")
    @ApiOperation(value = "判断是否是某协会的会员单位", notes = "判断是否是某协会的会员单位", httpMethod = "GET", produces = "mxf")
    Result judgeIsMember(@PathVariable("assocId") Long assocId, @PathVariable("companyId") Long companyId, @PathVariable("companyType") Long companyType);
}
